Skip to content

Ignore received packets that weren't sent during examine_flow#13203

Merged
StormLiangMS merged 4 commits intosonic-net:masterfrom
Ryangwaite:advanced-reboot-ignore-not-sent-rcvd-pkts
Jul 8, 2024
Merged

Ignore received packets that weren't sent during examine_flow#13203
StormLiangMS merged 4 commits intosonic-net:masterfrom
Ryangwaite:advanced-reboot-ignore-not-sent-rcvd-pkts

Conversation

@Ryangwaite
Copy link
Contributor

@Ryangwaite Ryangwaite commented Jun 10, 2024

Attempts to process received packets that weren't sent resulted in a KeyError exception in the examine_flow disruption calculation. This commit ignores them.

Description of PR

Summary:
Fixes # (issue)

Microsoft ADO: 27806353

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

The platform_tests.test_advanced_reboot.test_fast_reboot test was failing due to received packets that weren't sent.

How did you do it?

How did you verify/test it?

Modified the examine_flow function to run independently then tested the logic with a series of pcap files with various missing packets in the sequence. The cases included:

  • 100 packets, happy path
  • 100 packets, 0th packet receive missing
  • 100 packets, 0th packet send missing
  • 100 packets, 10th packet both missing, 11th packet both missing
  • 100 packets, 10th packet both missing, 11th packet receive missing
  • 100 packets, 10th packet both missing, 11th packet send missing
  • 100 packets, 10th packet both missing
  • 100 packets, 10th packet receive missing, 11th packet receive missing
  • 100 packets, 10th packet receive missing, 11th packet send missing
  • 100 packets, 10th packet receive missing
  • 100 packets, 10th packet send missing, 11th packet receive missing
  • 100 packets, 10th packet send missing, 11th packet send missing
  • 100 packets, 10th packet send missing
  • 100 packets, bunch of sad cases all in one:
    • pkt-10 both missing
    • pkt-15 send missing
    • pkt-20 receive missing
    • pkt-25 both missing, pkt-26 both missing
    • pkt-30 both missing, pkt-31 send missing
    • pkt-35 both missing, pkt-36 receive missing
    • pkt-45 receive missing, pkt-46 receive missing
    • pkt-55 receive missing, pkt-56 send missing
    • pkt-65 send missing, pkt-66 send missing
    • pkt-75 send missing, pkt-76 receive missing
  • 100 packets, first 10 packets missing

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@Ryangwaite Ryangwaite force-pushed the advanced-reboot-ignore-not-sent-rcvd-pkts branch from 4ed775f to d372ee4 Compare June 14, 2024 07:05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will miss the failure case - when there is a received packet drop and also a sent packet drop. We may not care if sent packets are not captured in pcap. But any drop in received packet should be reported.

Do not fail immediately upon noticing a received packet drop. We want to measure all received packet drops before concluding a failed state.

Copy link
Contributor Author

@Ryangwaite Ryangwaite Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the branch highlighted here, it handles the case where a received packet was present but no corresponding send packet in which case it logs it out, takes note of the received but not sent packet and carries on processing.

Further below, in the try-except while-loop it determines if packet IDs were missed for both send and receive from the pcaps and if so tracks them and continues processing.

Once all packets have been processed, if there were any that were missed from both send and received then these are logged out as a failure and the test will fail.

@vaibhavhd vaibhavhd requested a review from ryanzhu706 June 18, 2024 22:33
Attempts to process received packets that weren't sent resulted in a
KeyError exception in the examine_flow disruption calculation. This
commit ignores them and handles the case where there are missing
packet ID's in the stream.
@Ryangwaite Ryangwaite force-pushed the advanced-reboot-ignore-not-sent-rcvd-pkts branch from d372ee4 to ba3b2b4 Compare June 24, 2024 05:17
@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

ansible/roles/test/files/ptftests/py3/advanced-reboot.py:2019:121: E501 line too long (128 > 120 characters)
ansible/roles/test/files/ptftests/py3/advanced-reboot.py:2079:121: E501 line too long (139 > 120 characters)

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

We were initializing to 0 i.e. the first packet had been received
before we've even checked for it. This meant a scenario where the first
packet i.e. one with packet ID 0 was absent would be missed from the
both send and receive packet absent list.
@Ryangwaite Ryangwaite force-pushed the advanced-reboot-ignore-not-sent-rcvd-pkts branch from ba3b2b4 to 5056c12 Compare June 24, 2024 05:34
prev_payload = None
if packets:
prev_payload, prev_time = 0, 0
prev_payload, prev_time = -1, 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a problem where if the packet with packet id 0 (i.e. the first packet) was absent, it wouldn't be included in the analysis below. Changed to a non-packet ID by default to resolve this.

@Ryangwaite Ryangwaite requested a review from vaibhavhd June 25, 2024 03:10
Copy link
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StormLiangMS StormLiangMS merged commit 7aa6c67 into sonic-net:master Jul 8, 2024
@StormLiangMS
Copy link
Collaborator

@Ryangwaite do we need to cherry pick to 202311 and 202405?

@Ryangwaite
Copy link
Contributor Author

Ryangwaite commented Jul 8, 2024

@Ryangwaite do we need to cherry pick to 202311 and 202405?

@StormLiangMS Yes please

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 29, 2024
…net#13203)

What is the motivation for this PR?
The platform_tests.test_advanced_reboot.test_fast_reboot test was failing due to received packets that weren't sent.

How did you do it?
How did you verify/test it?
Modified the examine_flow function to run independently then tested the logic with a series of pcap files with various missing packets in the sequence. The cases included:

100 packets, happy path
100 packets, 0th packet receive missing
100 packets, 0th packet send missing
100 packets, 10th packet both missing, 11th packet both missing
100 packets, 10th packet both missing, 11th packet receive missing
100 packets, 10th packet both missing, 11th packet send missing
100 packets, 10th packet both missing
100 packets, 10th packet receive missing, 11th packet receive missing
100 packets, 10th packet receive missing, 11th packet send missing
100 packets, 10th packet receive missing
100 packets, 10th packet send missing, 11th packet receive missing
100 packets, 10th packet send missing, 11th packet send missing
100 packets, 10th packet send missing
100 packets, bunch of sad cases all in one:
pkt-10 both missing
pkt-15 send missing
pkt-20 receive missing
pkt-25 both missing, pkt-26 both missing
pkt-30 both missing, pkt-31 send missing
pkt-35 both missing, pkt-36 receive missing
pkt-45 receive missing, pkt-46 receive missing
pkt-55 receive missing, pkt-56 send missing
pkt-65 send missing, pkt-66 send missing
pkt-75 send missing, pkt-76 receive missing
100 packets, first 10 packets missing
Any platform specific information?
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #14323

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 29, 2024
…net#13203)

What is the motivation for this PR?
The platform_tests.test_advanced_reboot.test_fast_reboot test was failing due to received packets that weren't sent.

How did you do it?
How did you verify/test it?
Modified the examine_flow function to run independently then tested the logic with a series of pcap files with various missing packets in the sequence. The cases included:

100 packets, happy path
100 packets, 0th packet receive missing
100 packets, 0th packet send missing
100 packets, 10th packet both missing, 11th packet both missing
100 packets, 10th packet both missing, 11th packet receive missing
100 packets, 10th packet both missing, 11th packet send missing
100 packets, 10th packet both missing
100 packets, 10th packet receive missing, 11th packet receive missing
100 packets, 10th packet receive missing, 11th packet send missing
100 packets, 10th packet receive missing
100 packets, 10th packet send missing, 11th packet receive missing
100 packets, 10th packet send missing, 11th packet send missing
100 packets, 10th packet send missing
100 packets, bunch of sad cases all in one:
pkt-10 both missing
pkt-15 send missing
pkt-20 receive missing
pkt-25 both missing, pkt-26 both missing
pkt-30 both missing, pkt-31 send missing
pkt-35 both missing, pkt-36 receive missing
pkt-45 receive missing, pkt-46 receive missing
pkt-55 receive missing, pkt-56 send missing
pkt-65 send missing, pkt-66 send missing
pkt-75 send missing, pkt-76 receive missing
100 packets, first 10 packets missing
Any platform specific information?
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #14324

mssonicbld pushed a commit that referenced this pull request Sep 2, 2024
What is the motivation for this PR?
The platform_tests.test_advanced_reboot.test_fast_reboot test was failing due to received packets that weren't sent.

How did you do it?
How did you verify/test it?
Modified the examine_flow function to run independently then tested the logic with a series of pcap files with various missing packets in the sequence. The cases included:

100 packets, happy path
100 packets, 0th packet receive missing
100 packets, 0th packet send missing
100 packets, 10th packet both missing, 11th packet both missing
100 packets, 10th packet both missing, 11th packet receive missing
100 packets, 10th packet both missing, 11th packet send missing
100 packets, 10th packet both missing
100 packets, 10th packet receive missing, 11th packet receive missing
100 packets, 10th packet receive missing, 11th packet send missing
100 packets, 10th packet receive missing
100 packets, 10th packet send missing, 11th packet receive missing
100 packets, 10th packet send missing, 11th packet send missing
100 packets, 10th packet send missing
100 packets, bunch of sad cases all in one:
pkt-10 both missing
pkt-15 send missing
pkt-20 receive missing
pkt-25 both missing, pkt-26 both missing
pkt-30 both missing, pkt-31 send missing
pkt-35 both missing, pkt-36 receive missing
pkt-45 receive missing, pkt-46 receive missing
pkt-55 receive missing, pkt-56 send missing
pkt-65 send missing, pkt-66 send missing
pkt-75 send missing, pkt-76 receive missing
100 packets, first 10 packets missing
Any platform specific information?
mssonicbld pushed a commit that referenced this pull request Sep 2, 2024
What is the motivation for this PR?
The platform_tests.test_advanced_reboot.test_fast_reboot test was failing due to received packets that weren't sent.

How did you do it?
How did you verify/test it?
Modified the examine_flow function to run independently then tested the logic with a series of pcap files with various missing packets in the sequence. The cases included:

100 packets, happy path
100 packets, 0th packet receive missing
100 packets, 0th packet send missing
100 packets, 10th packet both missing, 11th packet both missing
100 packets, 10th packet both missing, 11th packet receive missing
100 packets, 10th packet both missing, 11th packet send missing
100 packets, 10th packet both missing
100 packets, 10th packet receive missing, 11th packet receive missing
100 packets, 10th packet receive missing, 11th packet send missing
100 packets, 10th packet receive missing
100 packets, 10th packet send missing, 11th packet receive missing
100 packets, 10th packet send missing, 11th packet send missing
100 packets, 10th packet send missing
100 packets, bunch of sad cases all in one:
pkt-10 both missing
pkt-15 send missing
pkt-20 receive missing
pkt-25 both missing, pkt-26 both missing
pkt-30 both missing, pkt-31 send missing
pkt-35 both missing, pkt-36 receive missing
pkt-45 receive missing, pkt-46 receive missing
pkt-55 receive missing, pkt-56 send missing
pkt-65 send missing, pkt-66 send missing
pkt-75 send missing, pkt-76 receive missing
100 packets, first 10 packets missing
Any platform specific information?
arista-hpandya pushed a commit to arista-hpandya/sonic-mgmt that referenced this pull request Oct 2, 2024
…net#13203)

What is the motivation for this PR?
The platform_tests.test_advanced_reboot.test_fast_reboot test was failing due to received packets that weren't sent.

How did you do it?
How did you verify/test it?
Modified the examine_flow function to run independently then tested the logic with a series of pcap files with various missing packets in the sequence. The cases included:

100 packets, happy path
100 packets, 0th packet receive missing
100 packets, 0th packet send missing
100 packets, 10th packet both missing, 11th packet both missing
100 packets, 10th packet both missing, 11th packet receive missing
100 packets, 10th packet both missing, 11th packet send missing
100 packets, 10th packet both missing
100 packets, 10th packet receive missing, 11th packet receive missing
100 packets, 10th packet receive missing, 11th packet send missing
100 packets, 10th packet receive missing
100 packets, 10th packet send missing, 11th packet receive missing
100 packets, 10th packet send missing, 11th packet send missing
100 packets, 10th packet send missing
100 packets, bunch of sad cases all in one:
pkt-10 both missing
pkt-15 send missing
pkt-20 receive missing
pkt-25 both missing, pkt-26 both missing
pkt-30 both missing, pkt-31 send missing
pkt-35 both missing, pkt-36 receive missing
pkt-45 receive missing, pkt-46 receive missing
pkt-55 receive missing, pkt-56 send missing
pkt-65 send missing, pkt-66 send missing
pkt-75 send missing, pkt-76 receive missing
100 packets, first 10 packets missing
Any platform specific information?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants